import express from "express"
import cookieParser from "cookie-parser"
import cookieSession from "cookie-session"
import consolidate from "consolidate"
import uuid from "uuid"
import morgan from "morgan"
import fs from "fs"
import bodyParser from "body-parser"
const app=express()
app.listen(8080)
//配置中间件
app.use(cookieParser("user"))
app.use(cookieSession({
	genid:function(){
		return uuid.v1()
	},
	maxAge:1000*60*20,
	secret:"user"
}))
app.use(morgan("combined",{stream:fs.createWriteStream("./logs/logs.log",{flag:"a"})}))
app.use(express.static("./public"))
app.use(bodyParser.urlencoded({
		extended:true,
		limite:1000
}))
//ejs设置
app.set("view engine","html")
app.set("views","views")
app.engine("html",consolidate.ejs)
app.use("/admin",require("./router/admin/adminRouter"))